(function(global){
    global.TRCKR.dispatcher = (function(){
        var context = global;
        var dispatcher = {
            dispatch: function(url){
                url = url || context.document.location.hash.slice(1);
                var parts = url.split('/');
                var controller = parts.shift();
                var action = parts.length ? parts.shift() : 'default'; //remaining 'parts' are just arguments for the controller method

                controller = TRCKR[controller + 'Controller']();
                controller[action].call(null, parts);
            },
            init: function(cont){
                context = cont || context;
                context.addEventListener("hashchange", this.dispatch, false);
            }
        };
        return dispatcher;
    })();
})(this);